﻿using FreeSql.DataAnnotations;
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PropertyChanged;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using static FreeSql.Internal.GlobalFilter;

namespace sys_Print.DataAsset
{
    [AddINotifyPropertyChangedInterface]
    [JsonObject(MemberSerialization.OptIn)]
    public partial class ContentEntries : ObservableObject
    {

        /// <summary>
        /// 分录自增号
        /// </summary>
        [JsonProperty, Column(Name = "content_entries_no", IsPrimary = true, IsIdentity = true)]
        public int ContentEntriesNo { get; set; }

        [JsonProperty, Column(Name = "attribute_name", DbType = "varchar(255)")]
        public string AttributeName { get; set; } = string.Empty;

        /// <summary>
        /// 内容模板编号
        /// </summary>
        [JsonProperty, Column(Name = "content_model_id")]
        public int ContentModelId { get; set; }

        [JsonProperty, Column(Name = "canvas_id")]
        public int CanvasId { get; set; }

        [JsonProperty, Column(Name = "content_name", DbType = "varchar(255)")]
        public string ContentName { get; set; } = string.Empty;

        /// <summary>
        /// 内容分录序号
        /// </summary>
        [JsonProperty, Column(Name = "order_no")]
        public int OrderNo { get; set; }

        [JsonProperty, Column(Name = "prefix", DbType = "varchar(255)")]
        public string Prefix { get; set; } = string.Empty;

        [JsonProperty, Column(Name = "suffix", DbType = "varchar(255)")]
        public string Suffix { get; set; } = string.Empty;

        [JsonProperty, Column(Name = "unit", DbType = "nvarchar(255)")]
        public string Unit { get; set; } = string.Empty;

        [JsonProperty, Column(Name = "content_change")]
        public bool ContentChange { get; set; }

        [JsonProperty, Column(Name = "contents")]
        public string Contents { get; set; } = string.Empty;
        
        [JsonProperty, Column(Name = "is_empty_hide")]
        public bool IsEmptyHide { get; set; }

        [JsonProperty, Column(IsIgnore = true)]
        public string AttriName { get; set; }

        [Column(IsIgnore = true)]
        public bool IsChanged { get; set; }


        public void AcceptChanges()
        {
            IsChanged = false;
        }






    }
}
